#include "base/core/lua_head.h"
#include "Script/ScriptMgr.h"
#include "Script/GlobalScriptFunc_LS.h"
#include "Character/monster/MonsterMgr.h"
#include "Duplicate/DuplicateMgr.h"

#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif

using namespace luabridge;



//获取普通刷怪信息(废弃)
int LuaGetCommonBrushInfo(lua_State* state)
{
	_UNUSE(state);
	//bool bresult = false;
	/*uint32_t nDuplicateID = 0;
	uint32_t nSceneID = 0;
	//
	LuaScript *pScript = g_GetScriptMgr()->GetScript();
	luabridge::LuaRef refLevel = luabridge::LuaRef::fromStack(state, lua_gettop(state));
	MMOLOG_PROCESS_ERROR(refLevel.isTable());
	MMOLOG_PROCESS_ERROR(pScript);
	MMOLOG_PROCESS_ERROR(refLevel.length() == 2);
	{
		luabridge::LuaRef refID = refLevel[1];
		luabridge::LuaRef refArea = refLevel[2];
		MMOLOG_PROCESS_ERROR(refID.isTable());
		MMOLOG_PROCESS_ERROR(refID.length() == 2);
		MMOLOG_PROCESS_ERROR(refArea.isTable());
		nDuplicateID = refID[1].cast<uint32_t>();
		nSceneID = refID[2].cast<uint32_t>();
		//g_GetDuplicateMgr()->CommonLuaCfg(nDuplicateID, nSceneID, refArea);
	}

Exit0:*/
	return 1;
}

//获取塔防刷怪信息(废弃)
int LuaGetTowerBrushInfo(lua_State* state)
{
	_UNUSE(state);
	//bool bresult = false;
	/*uint32_t nDuplicateID = 0;
	uint32_t nSceneID = 0;
	//
	LuaScript *pScript = g_GetScriptMgr()->GetScript();
	luabridge::LuaRef refLevel = luabridge::LuaRef::fromStack(state, lua_gettop(state));
	MMOLOG_PROCESS_ERROR(refLevel.isTable());
	MMOLOG_PROCESS_ERROR(pScript);
	MMOLOG_PROCESS_ERROR(refLevel.length() == 2);
	{
		luabridge::LuaRef refID = refLevel[1];
		luabridge::LuaRef refArea = refLevel[2];
		MMOLOG_PROCESS_ERROR(refID.isTable());
		MMOLOG_PROCESS_ERROR(refID.length() == 2);
		MMOLOG_PROCESS_ERROR(refArea.isTable());
		nDuplicateID = refID[1].cast<uint32_t>();
		nSceneID = refID[2].cast<uint32_t>();
		//g_GetDuplicateMgr()->TowerLuaCfg(nDuplicateID, nSceneID, refArea);
	}

Exit0:*/
	return 1;
}

//获取守护刷怪信息(废弃)
int LuaGetGuardBrushInfo(lua_State* state)
{
	_UNUSE(state);
	//bool bresult = false;
	/*uint32_t nDuplicateID = 0;
	uint32_t nSceneID = 0;
	//
	LuaScript *pScript = g_GetScriptMgr()->GetScript();
	luabridge::LuaRef refLevel = luabridge::LuaRef::fromStack(state, lua_gettop(state));
	MMOLOG_PROCESS_ERROR(refLevel.isTable());
	MMOLOG_PROCESS_ERROR(pScript);
	MMOLOG_PROCESS_ERROR(refLevel.length() == 2);
	{
		luabridge::LuaRef refID = refLevel[1];
		luabridge::LuaRef refArea = refLevel[2];
		MMOLOG_PROCESS_ERROR(refID.isTable());
		MMOLOG_PROCESS_ERROR(refID.length() == 2);
		MMOLOG_PROCESS_ERROR(refArea.isTable());
		nDuplicateID = refID[1].cast<uint32_t>();
		nSceneID = refID[2].cast<uint32_t>();
		//g_GetDuplicateMgr()->GuardLuaCfg(nDuplicateID, nSceneID, refArea);
	}


Exit0:*/
	return 1;
}


//获取工会刷怪信息(废弃)
int LuaGetUnionBrushInfo(lua_State* state)
{
	_UNUSE(state);
	//bool bresult = false;
	/*uint32_t nDuplicateID = 0;
	uint32_t nSceneID = 0;
	//
	LuaScript *pScript = g_GetScriptMgr()->GetScript();
	luabridge::LuaRef refLevel = luabridge::LuaRef::fromStack(state, lua_gettop(state));
	MMOLOG_PROCESS_ERROR(refLevel.isTable());
	MMOLOG_PROCESS_ERROR(pScript);
	MMOLOG_PROCESS_ERROR(refLevel.length() == 2);
	{
		luabridge::LuaRef refID = refLevel[1];
		luabridge::LuaRef refArea = refLevel[2];
		MMOLOG_PROCESS_ERROR(refID.isTable());
		MMOLOG_PROCESS_ERROR(refID.length() == 2);
		MMOLOG_PROCESS_ERROR(refArea.isTable());
		nDuplicateID = refID[1].cast<uint32_t>();
		nSceneID = refID[2].cast<uint32_t>();
		//g_GetDuplicateMgr()->UnionLuaCfg(nDuplicateID, nSceneID, refArea);
	}

Exit0:*/
	return 1;
}

//获取守护刷怪信息(废弃)
int LuaDupBlockInfo(lua_State* state)
{
	_UNUSE(state);
	//bool bresult = false;
	/*uint32_t nDuplicateID = 0;
	uint32_t nSceneID = 0;
	//
	LuaScript *pScript = g_GetScriptMgr()->GetScript();
	luabridge::LuaRef refLevel = luabridge::LuaRef::fromStack(state, lua_gettop(state));
	MMOLOG_PROCESS_ERROR(refLevel.isTable());
	MMOLOG_PROCESS_ERROR(pScript);
	MMOLOG_PROCESS_ERROR(refLevel.length() == 2);
	{
		luabridge::LuaRef refID = refLevel[1];
		luabridge::LuaRef refArea = refLevel[2];
		MMOLOG_PROCESS_ERROR(refID.isTable());
		MMOLOG_PROCESS_ERROR(refID.length() == 2);
		MMOLOG_PROCESS_ERROR(refArea.isTable());
		nDuplicateID = refID[1].cast<uint32_t>();
		nSceneID = refID[2].cast<uint32_t>();
		g_GetDuplicateMgr()->DupBlckLuaCfg(nDuplicateID, nSceneID, refArea);
	}

Exit0:*/
	return 1;
}



bool RegistGlobalLSScriptFunc(lua_State* state)
{
	getGlobalNamespace(state)
	//.addCFunction("GetCommonBrushInfo", LuaGetCommonBrushInfo)
	//.addCFunction("GetTowerBrushInfo", LuaGetTowerBrushInfo)
	//.addCFunction("GetGuardBrushInfo", LuaGetGuardBrushInfo)
	//.addCFunction("GetUnionBrushInfo", LuaGetUnionBrushInfo)
	//.addCFunction("DupBlockInfo",LuaDupBlockInfo)	
	;

	return true;
}

